#include <iostream>
#include <string>
using namespace std;

/*
    1. &取的地址编号必须赋值给指针变量
    2. *
*/ 
int main()
{
    string str = "我是字符串内容";

    string *pstr = &str;

    cout<<"pstr="<<pstr<<endl;
    cout<<"*pstr="<<*pstr<<endl;

    string str_new = "我是新的字符串内容";
    pstr = &str_new; // 修改指针指向
    
    cout<<"修改后的pstr="<<pstr<<endl;
    cout<<"修改后的*pstr="<<*pstr<<endl;

    *pstr = str; //修改指针内容

    cout<<"修改后的pstr="<<pstr<<endl;
    cout<<"修改后的*pstr="<<*pstr<<endl;

    system("pause");

    return 0;
}